package com.ys.nms.module.business.dal.mysql.sensors;

import java.util.*;

import com.ys.nms.framework.common.pojo.PageResult;
import com.ys.nms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ys.nms.framework.mybatis.core.mapper.BaseMapperX;
import com.ys.nms.module.business.dal.dataobject.sensors.SensorsDO;
import org.apache.ibatis.annotations.Mapper;
import com.ys.nms.module.business.controller.admin.sensors.vo.*;

/**
 * 传感器 Mapper
 *
 * @author zzy
 */
@Mapper
public interface SensorsMapper extends BaseMapperX<SensorsDO> {

    default PageResult<SensorsDO> selectPage(SensorsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SensorsDO>()
                .eqIfPresent(SensorsDO::getSensorDeleted, reqVO.getSensorDeleted())
                .eqIfPresent(SensorsDO::getSensorClass, reqVO.getSensorClass())
                .eqIfPresent(SensorsDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(SensorsDO::getPollerType, reqVO.getPollerType())
                .eqIfPresent(SensorsDO::getSensorOid, reqVO.getSensorOid())
                .eqIfPresent(SensorsDO::getSensorIndex, reqVO.getSensorIndex())
                .eqIfPresent(SensorsDO::getSensorType, reqVO.getSensorType())
                .eqIfPresent(SensorsDO::getSensorDescr, reqVO.getSensorDescr())
                .eqIfPresent(SensorsDO::getGroup, reqVO.getGroup())
                .eqIfPresent(SensorsDO::getSensorDivisor, reqVO.getSensorDivisor())
                .eqIfPresent(SensorsDO::getSensorMultiplier, reqVO.getSensorMultiplier())
                .eqIfPresent(SensorsDO::getSensorCurrent, reqVO.getSensorCurrent())
                .eqIfPresent(SensorsDO::getSensorLimit, reqVO.getSensorLimit())
                .eqIfPresent(SensorsDO::getSensorLimitWarn, reqVO.getSensorLimitWarn())
                .eqIfPresent(SensorsDO::getSensorLimitLow, reqVO.getSensorLimitLow())
                .eqIfPresent(SensorsDO::getSensorLimitLowWarn, reqVO.getSensorLimitLowWarn())
                .eqIfPresent(SensorsDO::getSensorAlert, reqVO.getSensorAlert())
                .eqIfPresent(SensorsDO::getSensorCustom, reqVO.getSensorCustom())
                .eqIfPresent(SensorsDO::getEntPhysicalIndex, reqVO.getEntPhysicalIndex())
                .eqIfPresent(SensorsDO::getEntphysicalindexMeasured, reqVO.getEntphysicalindexMeasured())
                .betweenIfPresent(SensorsDO::getLastupdate, reqVO.getLastupdate())
                .eqIfPresent(SensorsDO::getSensorPrev, reqVO.getSensorPrev())
                .eqIfPresent(SensorsDO::getUserFunc, reqVO.getUserFunc())
                .eqIfPresent(SensorsDO::getRrdType, reqVO.getRrdType())
                .orderByDesc(SensorsDO::getSensorId));
    }

}